package main

import (
	"github.com/micro/go-micro"
	"github.com/micro/go-micro/util/log"
	"ihome/getSmsCd/handler"
	"ihome/getSmsCd/subscriber"
	"ihome/utils"

	getSmsCd "ihome/proto/getSmsCd"
)

func main() {
	service := utils.NewGrpcService("go.micro.srv.getSmsCd")

	// Register Handler
	getSmsCd.RegisterGetSmsCdHandler(service.Server(), new(handler.GetSmsCd))

	// Register Struct as Subscriber
	micro.RegisterSubscriber("go.micro.srv.getSmsCd", service.Server(), new(subscriber.GetSmsCd))

	// Register Function as Subscriber
	micro.RegisterSubscriber("go.micro.srv.getSmsCd", service.Server(), subscriber.Handler)

	// Run service
	if err := service.Run(); err != nil {
		log.Fatal(err)
	}
}
